<template>
	<view class="view">
		
		<view class="pic-list">
			<view class="pic-item" v-for="(item,index) in picList" :key="item.id">
				<image :src="item.pictureUrl" style="height: 220rpx;border-radius: 20rpx;" @click="showViewer(item)"></image>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				billId:null,
				picList:null,
				
			}
		},
		onLoad(e) {
			this.billId = e.id
			this.getCheckedPic()
		},
		methods: {
			
			//获取已选图片
			getCheckedPic(){
				uni.$api.findPicByBillId(this.billId).then(res =>{
					this.picList = res
				})
			},
			//点击预览图片
			showViewer(current){
				let picurl = []
				picurl.push(current.pictureUrl)
				
				uni.previewImage({
					urls:this.picList.map(v => v.pictureUrl),
					current: current.pictureUrl,
				})
				
			},
			
		}
	}
</script>

<style>

.pic-item{
	width: 45%;
	display: inline-block;
	margin: 30rpx 15rpx 0 20rpx;
}

</style>
